from django.contrib import admin

# Register your models here.
from .models import *
from django.utils.html import format_html

admin.site.site_header = '相机商城'  # 页面头部的标题
admin.site.site_title = '相机商城后台管理'  # 浏览器标签页的标题


class GoodsmodelAdmin(admin.ModelAdmin):
    list_display = ('id','model_name')
    ordering = ('id',)

class GoodsAdmin(admin.ModelAdmin):
    list_display = ('id','goods_name', 'goods_price', 'goods_detail', 'goods_image','model')
    ordering = ('id',)

    def goods_image(self, obj):
        return format_html('<img src="/{}" style="width:100px;height:auto;">',obj.goods_img)



admin.site.register(Goodsmodel, GoodsmodelAdmin)
admin.site.register(Goods, GoodsAdmin)





